package com.leozhang.portalssm.servicetest;

import com.fasterxml.jackson.databind.annotation.JsonAppend;
import com.leozhang.portalssm.entity.Assets;
import com.leozhang.portalssm.entity.Dept;
import com.leozhang.portalssm.entity.Menu;
import com.leozhang.portalssm.entity.Sex;
import com.leozhang.portalssm.mapper.AssetsMapper;
import com.leozhang.portalssm.service.*;
import com.leozhang.portalssm.util.Result;
import org.codehaus.jackson.annotate.JsonTypeInfo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})

public class JUnit4test {




     @Autowired
     private SexService sexService;

     @Autowired
     private MenuService menuService;

     @Autowired
     private AssetService assetService;

     @Autowired
     private AssetsStatusService assetsStatusService;

     @Autowired
     private DeptService deptService;
    @Test
    public void Test1(){
//        Result result = sexService.getListForPage(1, 10, "", "", "");
//        menuService.selectMenuListByRoleId("1");
//        System.out.println(result);
        Result result = assetsStatusService.getListForPage(1, 10, "冻结", "", "");
        Object data = result.getData();
        System.out.println("我是结果=================："+data);
    }
    @Test
    public void Test2(){
        Assets a = new Assets();
        a.setAssetTypeName("五险一金");
        a.setId(null);
        assetService.insertAssets(a);

    }
    @Test
    public void Test3(){
        Sex sex = new Sex();
        sex.setSexName("一男半女");
        sexService.insertSex(sex);
    }

    @Test
    public void Test4(){


        Assets assets = new Assets();
        assets.setId((long)1);
        assets.setAssetTypeName("十险一金");
        assetService.updateAssets(assets);
         Assets asset = assetService.selectAssetsById((long) 1);
        System.out.println("======================================="+asset);

    }
    @Test
    public void Test5(){
        Dept dept = deptService.selectDeptById((long) 1);
        System.out.println("-------------------------------"+dept);
    }

    @Test
    public void Test6(){
        Dept dept = new Dept();
        dept.setName("董事长");
        dept.setId((long)15);
        deptService.updateDeptById(dept);
    }


    @Test
    public void Test7(){
        Menu menu = menuService.selectMenuById((long) 31);
        System.out.println("-------------------------------"+menu);

    }





}
